home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4169 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: news.lpr.carel.fi!usenet
  2. From: Ari Lukumies <aril@cmt.lpr.mail.carel.fi>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: a link problem
  5. Date: Fri, 02 Feb 1996 14:12:40 +0200
  6. Organization: Carelcomp Forest
  7. Message-ID: <3111FFB8.2BBA@cmt.lpr.mail.carel.fi>
  8. References: <4ers17$4c3@srvr1.engin.umich.edu>
  9. NNTP-Posting-Host: renoir.cclahti.carel.fi
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0b6a (WinNT; I)
  14.  
  15. Chih-Jen Lin wrote:
  16. > Hi,
  17. > It seems that the order of .o files in makefile affect
  18. > link result. For example, if function A in a.c call function
  19. > B in b.c, then I need to use
  20. > %cc  ...   a.o b.o
  21. > and can't use
  22. > %cc  ...   b.o a.o
  23. > This looke very inconvinent. Is there any way to solve
  24. > this problem ? Thanks for your help.
  25. > Chih-Jen Lin
  26.  
  27. Not unless your linker reads all files in and only after that tries to resolve 
  28. the external references. Check the command line options (man ld). You could, of 
  29. course, create a library where you stored your .o files (except the main file) 
  30. and link with that. (cc ... a.o -lxx...).
  31.  
  32. Later,
  33.  AriL
  34. -- 
  35. All my opinions are mine and mine alone.
  36.